//
//  DestinationCell.m
//  ImGuider
//
//  Created by 李陆涛 on 2017/12/11.
//  Copyright © 2017年 imguider. All rights reserved.
//

#import "DestinationCell.h"

@interface DestinationCell ()

@property (weak, nonatomic) IBOutlet UIImageView *destinationImageView;
@property (weak, nonatomic) IBOutlet UILabel *cityNameLabel;
@property (weak, nonatomic) IBOutlet UIView *mengbanView;
@end


@implementation DestinationCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    self.mengbanView.backgroundColor = kMengBanColor;
}

- (void)setCity:(City *)city {
    
    _city = city;
    
    [self.destinationImageView setImageURL:[NSURL URLWithString:city.pictures] placeholderImage:kPlaceholderRec];
    
    NSString *cityText = city.smartName;
    
    NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:cityText];
    
    attr.font = Font(30);
    attr.color = [UIColor whiteColor];
    
    if (city.isGPS) {
        
        NSMutableAttributedString *gpsAttr = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"\n%@",MYLocalizedString(@"CHANGECITY_GPS_LOAD", nil)]];
        
        gpsAttr.font = Font(17);
        gpsAttr.color = [UIColor whiteColor];
        
        [attr appendAttributedString:gpsAttr];
    }
    
    self.cityNameLabel.attributedText = attr;
}

@end
